$(function() {
    var index = parent.layer.getFrameIndex(window.name);
    parent.layer.iframeAuto(index);

    $(".select-product-apqpProduct").on("click", function() {
        var id = $(this).data("id");
        var name = $(this).data("name");
        parent.layui.$("#productId").val(id);
        parent.layui.$("#productName").val(name);
        parent.layer.close(index);
    });

    $(".select-product-pfmea").on("click", function() {
        var modelId = parent.$("#modelId").val();
        var id = $(this).data("id");
        if (parent.$("#productId").val() != id) {
            var url = "/fmea/pfmea_product/step1/" + modelId + "?productId=" + id;
            parent.window.location.href = url;
        } else {
            parent.layer.tips("已选择", "input[name='productCode'][id='" + id + "']", {
                time : 3000
            });
        }
        parent.layer.close(index);
    });
});